package physics;

/**
 *
 * @author peter
 */
public class PMatrix {
	private PVector col0;
	private PVector col1;


	// GETTERS & SETTERS
	public PVector getCol0()
	{
		return col0;
	}

	public void setCol0(PVector col0)
	{
		this.col0 = col0;
	}

	public PVector getCol1()
	{
		return col1;
	}

	public void setCol1(PVector col1)
	{
		this.col1 = col1;
	}

	// CONSTRUCTORS
	public PMatrix()
	{
	}

	public PMatrix(double angle)
	{
		double cos = (double) Math.cos(angle);
		double sin = (double) Math.sin(angle);
		col0 = new PVector(cos,sin);
		col1 = new PVector(-sin, cos);
	}

	public PMatrix(PVector col0, PVector col1)
	{
		this.col0= new PVector(col0);
		this.col1= new PVector(col1);
	}

	public PMatrix(double ax, double ay, double bx, double by)
	{
		this.col0= new PVector(ax, ay);
		this.col1= new PVector(bx, by);
	}

	// METHODS

	public PMatrix clone()
	{
		return new PMatrix(new PVector(col0.getX(), col1.getX()), new PVector(col0.getY(), col1.getY()));
	}

	public PVector mul(PVector v)
	{
		return new PVector(col0.getX() * v.getX() + col1.getX() * v.getY(), col0.getY() * v.getX() + col1.getY() * v.getY());
	}

	public String toString()
	{
		return "[" + col0.getX() + ", " + col1.getX() + "]\n[" + col0.getY() + ", " + col1.getY() + "]";
	}

}
